package com.huluobo.h3kotlinproject.home

import androidx.lifecycle.MutableLiveData
import com.huluobo.h3kotlinproject.base.BaseViewModel
import com.huluobo.h3kotlinproject.data.GoodsListResult

/**
 *  Created by LC on 2023/10/21.
 */
class HomeViewModel : BaseViewModel() {
    private val repo = HomeRepo()

    val goodListSuccess = MutableLiveData<GoodsListResult>()
    val goodListFailed = MutableLiveData<String>()

    val bannerSuccess = MutableLiveData<HomeBannerBeanResult>()
    val bannerFailed = MutableLiveData<String>()

    val navSuccess = MutableLiveData<NavGoodsBeanResult>()
    val navFailed = MutableLiveData<String>()


    fun getHomeGoodsList(
        categoryId: Int,
        currentPage: Int,
        pageSize: Int
    ) {
        repo.getHomeList(categoryId, currentPage, pageSize, goodListSuccess, goodListFailed)
    }

    fun getHomeBanners() {
        repo.getBanners(bannerSuccess, bannerFailed)
    }

    fun getNav() {
        repo.getNav(navSuccess, navFailed)
    }

}